package com.exam.sacrifice.ui.baijiaxing;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;

import com.exam.commonbiz.base.BaseFragment;
import com.exam.commonbiz.base.BaseViewModel;
import com.exam.sacrifice.R;
import com.exam.sacrifice.databinding.FragmentQiyuanBinding;
import com.exam.sacrifice.ui.adapter.FenBuZhanBiAdapter;
import com.exam.sacrifice.ui.adapter.LiShiMingRenAdapter;
import com.exam.sacrifice.ui.adapter.QiYuanAdapter;
import com.exam.sacrifice.ui.bean.BaiJiaXingInfo;

import java.util.ArrayList;
import java.util.List;

public class QiYuanFragment extends BaseFragment<BaseViewModel, FragmentQiyuanBinding> {

    public static QiYuanFragment newInstance() {
        QiYuanFragment fragment = new QiYuanFragment();
        return fragment;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_qiyuan;
    }

    @Override
    public void initData() {

        List<BaiJiaXingInfo> baiJiaXingInfoList = new ArrayList<>();
        baiJiaXingInfoList.add(new BaiJiaXingInfo("赵氏"));
        baiJiaXingInfoList.add(new BaiJiaXingInfo("钱氏"));

        QiYuanAdapter qiYuanAdapter = new QiYuanAdapter();
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
        binding.recyclerView.setLayoutManager(linearLayoutManager);
        binding.recyclerView.setAdapter(qiYuanAdapter);
        binding.recyclerView.setNestedScrollingEnabled(false);
        qiYuanAdapter.setNewData(baiJiaXingInfoList);

        List<BaiJiaXingInfo> baiJiaXingInfoList2 = new ArrayList<>();
        baiJiaXingInfoList2.add(new BaiJiaXingInfo("河南省"));
        baiJiaXingInfoList2.add(new BaiJiaXingInfo("安徽省"));
        baiJiaXingInfoList2.add(new BaiJiaXingInfo("山东省"));

        FenBuZhanBiAdapter fenBuZhanBiAdapter = new FenBuZhanBiAdapter();
        LinearLayoutManager linearLayoutManager2 = new LinearLayoutManager(context);
        binding.recyclerViewFenBu.setLayoutManager(linearLayoutManager2);
        binding.recyclerViewFenBu.setAdapter(fenBuZhanBiAdapter);
        binding.recyclerViewFenBu.setNestedScrollingEnabled(false);
        fenBuZhanBiAdapter.setNewData(baiJiaXingInfoList2);

        List<BaiJiaXingInfo> baiJiaXingInfoList3 = new ArrayList<>();
        baiJiaXingInfoList3.add(new BaiJiaXingInfo("赵云"));
        baiJiaXingInfoList3.add(new BaiJiaXingInfo("赵云"));

        LiShiMingRenAdapter liShiMingRenAdapter = new LiShiMingRenAdapter();
        GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 2);
        binding.recyclerViewMingRen.setLayoutManager(gridLayoutManager);
        binding.recyclerViewMingRen.setAdapter(liShiMingRenAdapter);
        binding.recyclerViewMingRen.setNestedScrollingEnabled(false);
        liShiMingRenAdapter.setNewData(baiJiaXingInfoList3);
    }


    @Override
    protected void loadData() {

    }
}
